import Mock from 'mockjs'

// driverId = 224
// const fleetId = '37'
const driverList = []
const tarrierList = []
const carrierList = []
const count = 22


// fleetDriverList()
for (let i = 0; i < count; i++) {
  driverList.push(Mock.mock({
    'id': 303,
    'name': '@cname',
    'mobile': '13049352555',
    'dob': '@dob',
    'yod': 27,
    'sex': 1,
    'serviceType': null,
    'openId': null,
    'accountId': null,
    'lspId': null,
    'fleetId': null,
    'drivingLicenseType': null,
    'status': 1,
    'authStatus': null,
    'creator': null,
    'gmtCreate': null,
    'createFrom': null,
    'gmtUpdate': null,
    'businessSite': null,
    'tenantId': null,
    'isDelete': null
  }))
}

// fleetTarrierList()
for (let i = 0; i < count; i++) {
  tarrierList.push(Mock.mock({
    'id': 14,
    'plate': '赣A3232挂',
    'ownerName': null,
    'ownerMobile': null,
    'plateAnno': null,
    'manufacturer': '阿斯顿',
    'length': 2.0,
    'width': 2.0,
    'height': 2.0,
    'gmtManu': null,
    'gmtAs': null,
    'model': '阿斯顿',
    'axisNumber': null,
    'selfWeight': null,
    'lspId': null,
    'trailerType': '三位平板',
    'fleetId': null,
    'status': 1,
    'authStatus': null,
    'creator': null,
    'gmtCreate': null,
    'createFrom': null,
    'gmtUpdate': null,
    'tenantId': null,
    'isDelete': null
  }))
}

// fleetCarrierList()
for (let i = 0; i < count; i++) {
  carrierList.push(Mock.mock({
    'id': 24,
    'plate': '赣H91257',
    'ownerName': null,
    'ownerMobile': null,
    'plateAnno': null,
    'manufacturer': '1',
    'length': null,
    'width': 10.0,
    'height': null,
    'gmtManu': null,
    'gmtAs': null,
    'model': '',
    'axisNumber': null,
    'travelledDist': null,
    'minNl': null,
    'maxNl': null,
    'minFl': null,
    'maxFl': null,
    'selfWeight': null,
    'lspId': null,
    'fleetId': null,
    'status': 1,
    'authStatus': null,
    'creator': null,
    'gmtCreate': null,
    'createFrom': null,
    'gmtUpdate': null,
    'tenantId': null,
    'isDelete': null,
    'tractorType': null
  }))
}

export default {
  // 公司-车队下的司机分页查询(lspm)
  fleetDriverList: config => {
    // console.log('mock-shipOrderApi-getWaybillList()-config', config)
    const { current, size, condition } = JSON.parse(config.body)
    const mockList = driverList.filter(item => {
      if (condition !== undefined) {
        if (condition.fleetId === '') return false
      }
      return true
    })
    const pageList = mockList.filter((item, index) => index < size * current && index >= size * (current - 1))
    // console.log('mock-shipOrderApi-geList()-pageList', pageList)
    const resData = {
      'code': 0,
      'data': {
        'total': mockList.length,
        'size': size,
        'pages': 0,
        'current': current,
        'records': pageList,
        'condition': {
          'fleetName': ''
        },
        'asc': true,
        orderByField: 'gmt_create',
        'offsetCurrent': 0
      },
      'message': 'success'
    }
    console.log('mock-shipOrderApi-geList()-resData', resData)
    return resData
  },
  // 公司-车队下的挂车分页查询(lspm)
  fleetTarrierList: config => {
    // console.log('mock-shipOrderApi-getWaybillList()-config', config)
    const { current, size, condition } = JSON.parse(config.body)
    const mockList = tarrierList.filter(item => {
      if (condition !== undefined) {
        if (condition.fleetId === '') return false
      }
      return true
    })
    const pageList = mockList.filter((item, index) => index < size * current && index >= size * (current - 1))
    // console.log('mock-shipOrderApi-geList()-pageList', pageList)
    const resData = {
      'code': 0,
      'data': {
        'total': mockList.length,
        'size': size,
        'pages': 0,
        'current': current,
        'records': pageList,
        'condition': {
          'fleetName': ''
        },
        'asc': true,
        orderByField: 'gmt_create',
        'offsetCurrent': 0
      },
      'message': 'success'
    }
    console.log('mock-shipOrderApi-geList()-resData', resData)
    return resData
  },
  // 公司-车队下的牵引车分页查询(lspm)
  fleetCarrierList: config => {
    // console.log('mock-shipOrderApi-getWaybillList()-config', config)
    const { current, size, condition } = JSON.parse(config.body)
    const mockList = carrierList.filter(item => {
      if (condition !== undefined) {
        if (condition.fleetId === '') return false
      }
      return true
    })
    const pageList = mockList.filter((item, index) => index < size * current && index >= size * (current - 1))
    // console.log('mock-shipOrderApi-geList()-pageList', pageList)
    const resData = {
      'code': 0,
      'data': {
        'total': mockList.length,
        'size': size,
        'pages': 0,
        'current': current,
        'records': pageList,
        'condition': {
          'fleetName': ''
        },
        'asc': true,
        orderByField: 'gmt_create',
        'offsetCurrent': 0
      },
      'message': 'success'
    }
    console.log('mock-shipOrderApi-geList()-resData', resData)
    return resData
  }

}

